package org.linuxgears.BouncingBall.mover.strategy;

import java.awt.Point;

import org.linuxgears.BouncingBall.tools.BallTools;

public class LineMovingStrategy implements ProgressiveMovingStrategy {
    public static final double DEFAULT_BALL_VELOCITY = 4;
    
	private Point velocity;
	private Point position;

	public LineMovingStrategy() {
		position = new Point(0, 0);
	}

	@Override
	public Point getPosition() {
		return position;
	}

	@Override
	public void move() {
		position.x += velocity.x;
		position.y += velocity.y;
	}

	@Override
	public void setTargetPoint(Point target) {
		velocity = BallTools.expandVector(position, target, DEFAULT_BALL_VELOCITY);
	}

	@Override
	public Point getVelocity() {
		return velocity;
	}

	@Override
	public void setVelocity(Point velocity) {
		this.velocity = velocity; 
	}

	@Override
	public void setPosition(Point position) {
		this.position = position;
	}

}
